<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('设备型号列表')" />
</head>
<body class="gray-bg">

     <div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="formId">
					<div class="select-list">
						<ul>
							<li>
								型号：<input type="text" name="modelNumber"/>
							</li>

							<li>
								类型：<input type="text" name="modelType"/>
							</li>

							<li>
								代号：<input type="text" name="modelCode"/>
							</li>
							<li>

								设备类型：<select name="deviceType" th:with="type=${@dict.getType('sys_device_type')}">
								<option value="">所有</option>
								<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
							</select>
							</li>

							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
								<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>
			</div>

	        <div class="btn-group-sm" id="toolbar" role="group">
				<a class="btn btn-success" onclick="$.operate.addDeviceModel()" shiro:hasPermission="system:deviceModel:add">
					<i class="fa fa-plus"></i> 添加
				</a>
<!--				<a class="btn btn-primary btn-edit disabled" onclick="$.operate.editDeviceModel()" shiro:hasPermission="system:deviceModel:edit">-->
<!--					<i class="fa fa-edit"></i> 修改-->
<!--				</a>-->
				<a class="btn btn-danger btn-del btn-del disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:deviceModel:remove">
					<i class="fa fa-remove"></i> 删除
				</a>
				<a class="btn btn-info" onclick="$.table.importExcel()" shiro:hasPermission="system:deviceModel:import">
					<i class="fa fa-upload"></i> 导入
				</a>
				<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:deviceModel:export">
						<i class="fa fa-download"></i> 导出
				 </a>
			</div>
			<div class="col-sm-12 select-table table-striped">
				<table id="bootstrap-table" data-mobile-responsive="true" style="table-layout:fixed"></table>
			</div>
		</div>
	</div>
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('system:deviceModel:edit')}]];
        var removeFlag = [[${@permission.hasPermi('system:deviceModel:remove')}]];
        var prefix = ctx + "system/deviceModel";
		var types = [[${@dict.getType('sys_device_type')}]];
        $(function() {
			$('input:not([autocomplete]),textarea:not([autocomplete]),select:not([autocomplete])').attr('autocomplete', 'off');
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
				exportUrl: prefix + "/export",
				importUrl: prefix + "/importData",
				importTemplateUrl: prefix + "/importTemplate",
                modalName: "设备型号",
		        showExport: false,
				sortName:"modelCode",
				uniqueId:"modelId",
                columns: [{
		            checkbox: true
		        },

				{
					field : 'modelId',
					title : '型号ID',
					visible: false,
					formatter: function(value, row, index) {
						var html ="<span style='white-space:nowrap'>"+value+"</span>"
						return html;
					}
				},
					{
						title: "序号",
						formatter: function (value, row, index) {
							return $.table.serialNumber(index);
						}
					},
				{
					field : 'modelNumber',
					title : '型号',
					sortable: true,
					width:200,
					formatter: function(value, row, index) {
						var tooltip = $.table.tooltip(value);
						var html ="<span style='white-space:nowrap'>"+tooltip+"</span>";
						return html;
					}
				},
				{
					field : 'modelType',
					title : '类型',
					sortable: true,
					formatter: function(value, row, index) {
						var html ="<span style='white-space:nowrap'>"+value+"</span>"
						return html;
					}
				},
				{
					field : 'modelCode',
					title : '代号',
					sortable: true,
					formatter: function(value, row, index) {
						var html ="<span style='white-space:nowrap'>"+value+"</span>"
						return html;
					}
				},
				{
					field : 'deviceType',
					title : '设备类型',
					sortable: true,
					formatter: function(value, row, index) {
						return $.table.selectDictLabel(types, value);
					}
				},
				{
					field : 'createBy',
					title : '创建者',
					sortable: true,
					formatter: function(value, row, index) {
						var html ="<span style='white-space:nowrap'>"+value+"</span>"
						return html;
					}
				},
				{
					field : 'createTime',
					title : '创建时间',
					sortable: true,
					formatter: function(value, row, index) {
						var html ="<span style='white-space:nowrap'>"+value+"</span>"
						return html;
					}
				},
				{
					field : 'updateBy',
					title : '更新者',
					sortable: false,
					visible: false,
					formatter: function(value, row, index) {
						var html ="<span style='white-space:nowrap'>"+value+"</span>"
						return html;
					}
				},
				{
					field : 'updateTime',
					title : '更新时间',
					sortable: false,
					visible: false,
					formatter: function(value, row, index) {
						var html ="<span style='white-space:nowrap'>"+value+"</span>"
						return html;
					}
				},
				{
					field : 'remark',
					title : '备注',
					sortable: false,
					formatter: function(value, row, index) {
						var tooltip = $.table.tooltip(value);
						var html ="<span style='white-space:nowrap'>"+tooltip+"</span>"
						return html;
					}
				},

		        {
		            title: '操作',
		            align: 'center',
		            formatter: function(value, row, index) {
		            	var actions = [];
						actions.push('<span style=\'white-space:nowrap\'>');
		            	actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.editDeviceModel(\'' + row.modelId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.modelId + '\')"><i class="fa fa-remove"></i>删除</a>');
						actions.push('</span>');
                        return actions.join('');
		            }
		        }]
            };
            $.table.init(options);
        });
    </script>
</body>
<form id="importForm" enctype="multipart/form-data" class="mt20 mb10" style="display: none;">
	<div class="col-xs-offset-1">
		<input type="file" id="file" name="file"/>
		<div class="mt10 pt5">
<!--			<input type="checkbox" id="updateSupport" name="updateSupport" title="如果登录账户已经存在，更新这条数据。"> 是否更新已经存在的人员数据-->
			&nbsp;	<a onclick="$.table.importTemplate()" class="btn btn-default btn-xs"><i class="fa fa-file-excel-o"></i> 下载模板</a>
		</div>
		<font color="red" class="pull-left mt10">
			提示：仅允许导入“xls”或“xlsx”格式文件！
		</font>
	</div>
</form>
</html>